const QHUtil = require('./QHUtil.js');

function QHApi (config) {
    this.config = config;
}

// 获取任务分类
// @param data  请求参数，例如 {user_id:1}
// @param callbackFunc(err, respBody, respInfo)
QHApi.prototype.getTaskClass = function (data, callbackFunc) {
    QHUtil.request(this.config, '/business/sdk/v1/read/get_task_class', data, callbackFunc);
};

// 获取任务列表
// @param data  请求参数，例如 {user_id:1}
// @param callbackFunc(err, respBody, respInfo)
QHApi.prototype.getTaskList = function (data, callbackFunc) {
    QHUtil.request(this.config, '/business/sdk/v1/read/get_task_list', data, callbackFunc);
};

// 一键领取任务
// @param data  请求参数，例如 {user_id:1}
// @param callbackFunc(err, respBody, respInfo)
QHApi.prototype.getReadTask = function (data, callbackFunc) {
    QHUtil.request(this.config, '/business/sdk/v1/read/one_click_collection', data, callbackFunc);
};

// 更新异步通知连接
// @param data  请求参数，例如 {notify_url:'http://read.xxx.com'}
// @param callbackFunc(err, respBody, respInfo)
QHApi.prototype.updateNotifyUrl = function (data, callbackFunc) {
    QHUtil.request(this.config, '/business/sdk/v1/read/update_notify_url', data, callbackFunc);
};

module.exports = QHApi;
